Form or Browse Table Pointer
Description
When a form is opened it creates a new session, and it opens the table that it is based on. In the case where the form is based on a set, the Form will open all of the tables in the set.
You can get a pointer to the table(s) opened by the Form using several techniques: A script attached to a button on a Form, or to a Form event, could execute the command:
'get the primary table for the Form's session tbl = table.current()
or
tbl = topparent.table_get() 'get a pointer to a child table in the Form's session tbl = topparent.table_get("tablename")
To get a pointer to the table for another open Form window:
'get a pointer to the primary table tbl = <Form Pointer>.table_get()
To get a pointer to the table for an embedded Browse object (called 'Browse1' in this example) on a form:
tbl = Topparent:Browse1.table_get()
To get a pointer to the table for an embedded Browse object (called 'Browse1' in this example) on another open Form window:
tbl = <Form Pointer>:Browse1.table_get()
Once you have a pointer to the table(s) that the Form opened, you can manipulate these tables "behind the scenes" using the methods of the Table object. For example, you can use the <TBL>.FETCH_NEXT() method to move the record pointer. However, the Form will not reflect any changes you make "behind the scenes" until you use the Form's <FORM>.RESYNCH() method to re-synchronize the Form with the data in the underlying table. Contrast this with the Form's <FORM>.FETCH_NEXT() method, which will cause the next record to be displayed on the Form immediately (no need to use the .RESYNCH() method). This example show how you can simulate the form's .FETCH_NEXT() method by moving the record pointer behind the scenes.
'This script is attached to a button on a form tbl = table.current() 'Move the record pointer behind the scenes to the next record tbl.fetch_next() 'Resynchronize the form to the record pointer topparent.resynch() 'This script does the same as the above using the fetch_next method of the form topparent.fetch_next()
RESYNCH() method to re-synchronize the Form with the underlying table, and then you begin to edit a field on the Form, Alpha Anywhere will automatically move the record pointer back to the current record that is displayed on the Form before editing begins.
RESYNCH() method is executed.
See Also